package org.omich.loaves;

import android.bluetooth.BluetoothDevice;

public class LocalBrainClient implements IBrainClient {
	protected IBrain mBrain;
	private BluetoothBrainServer mBluetoothBrainServer;
	private INetworkTransport mTransport;
	
	LocalBrainClient(INetworkTransport transport) {
		mTransport = transport;
		mBrain = new MainBrain();
		mBluetoothBrainServer = new BluetoothBrainServer(mBrain, transport);
	}
	
	@Override
	public void tryToEatLoaf(String playerName, int loafNumber) {
		//if (mBluetoothBrainServer.isConnected())
		mBrain.tryToEatLoaf(playerName, loafNumber);
	}

	@Override
	public void getStatus(IGettingsStatusHandler... arg0) {
		arg0[0].handle(mBrain.getStatus());
	}
	
	@Override
	public String getPlayerName() {
		return mTransport.getName();
	}
	
	@Override
	public void newGame(int loavesAmount, int maxWeight) {
		mBrain.newGame(loavesAmount, maxWeight);
	}
	
	@Override
	public void connectToServer(BluetoothDevice device) {}
}
